package com.smartrodin.springbootrabbitmq.config.mybatisplus;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * MybatisPlusConfig
 *
 * @author back_zhang
 */
@EnableTransactionManagement
@Configuration
public class MybatisPlusConfig {

    /**
     * 分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    /**
     * 自定义 SqlInjector,里面包含自定义的全局方法（ISqlInjector 该类是父类，所以逻辑删除的注入代码注掉）,该方法导致 逻辑删除 不可用，故将升级 MP
     *
     * @return
     */
    @Bean
    public MyBatisPlusSqlInjector myLogicSqlInjector() {
        return new MyBatisPlusSqlInjector();
    }
}
